﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:markup="clr-namespace:Elysium.Markup"
                    xmlns:params="clr-namespace:Elysium.Parameters"
                    xmlns:controls="clr-namespace:Elysium.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Themes/Buttons/CommandButtonBase.ApplicationBar.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ToggleCommandButtonApplicationBarStyle" TargetType="{x:Type controls:ToggleCommandButton}" BasedOn="{StaticResource CommandButtonBaseApplicationBarStyle}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsChecked" Value="True"/>
                    <Condition Property="params:Animation.Type" Value="None"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Background" Value="{markup:ThemeResource ContrastBrush}"/>
                    <Setter Property="BorderBrush" Value="{markup:ThemeResource ContrastBrush}"/>
                    <Setter Property="params:CommandButtons.Mask" Value="{markup:ThemeResource AccentBrush}"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsChecked" Value="True"/>
                    <Condition Property="params:Animation.Type" Value="Fade"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation Storyboard.TargetProperty="Background.(SolidColorBrush.Color)"
                                            Duration="{markup:ThemeResource OptimumDuration}"
                                            To="{markup:ThemeResource ContrastColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="BorderBrush.(SolidColorBrush.Color)"
                                            Duration="{markup:ThemeResource OptimumDuration}"
                                            To="{markup:ThemeResource ContrastColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="(params:CommandButtons.Mask).(SolidColorBrush.Color)"
                                            Duration="{markup:ThemeResource OptimumDuration}"
                                            To="{markup:ThemeResource AccentColor}"/>
                        </Storyboard>
                    </BeginStoryboard>
                </MultiTrigger.EnterActions>
            </MultiTrigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>